import React from 'react'
import { useLocation, useParams } from "react-router-dom"
import qs from "qs"

export default function Music() {
  const location = useLocation()
  const { user } = qs.parse(location.search.split("?")[1])
  const { state } = location
  const {id} = useParams()

  return (
    <div>
      <h3>Music</h3>
      <p>用户名是:{user}编号是:{id}</p>
      {
        state.map(item => {
          return <li key={item.id}>{item.name}</li>
        })
      }
    </div>
  )
}
